<template>
  <div>
    <a-modal v-model="visible" title="指定结算" :width="500" centered destroyOnClose class="return-modal" @ok="handleSubmit" @cancel="resetModal">
      <a-select v-model="brand" placeholder="请选择" :getPopupContainer="triggerNode => triggerNode.parentNode" style="width:200px;">
        <a-select-option value="">请选择</a-select-option>
        <a-select-option :value="item" v-for="(item, index) in list" :key="index">{{ item }}</a-select-option>
      </a-select>
    </a-modal>
  </div>
</template>
<script>
import { explicitBrandIncome } from '@/api/box/order'
export default {
  data() {
    return {
      visible: false,
      list: ['江南布衣+', 'OUTLETS', 'JNBY', 'less', 'CROQUIS', 'jnby by JNBY', 'Pomme de terre', 'JNBYHOME', 'APN73'],
      brand: '',
      boxId: ''
    }
  },
  methods: {
    show(boxId, explicitBrand) {
      this.visible = true
      this.boxId = boxId
      if (explicitBrand != null) {
        this.brand = explicitBrand
      } else {
        this.brand = ''
      }
    },
    handleSubmit() {
      let params = {
        requestData: {
          boxId: this.boxId,
          explicitBrand: this.brand
        }
      }
      explicitBrandIncome(params).then(res => {
        if (res.code == 0) {
          this.$message.success('指定成功！')
          this.resetModal()
          this.$emit('updateTable')
        } else {
          this.$message.warning(res.msg)
        }
      })
    },
    resetModal() {
      this.visible = false
      this.brand = ''
      this.boxId = ''
    }
  }
}
</script>
